Some programming languages are purely procedural, others are purely object-oriented, and some are a hybrid. In a procedural language, such as C, every call is a function call. In an object-oriented language, such as Java, every call is a method call. In a hybrid language, such as Perl, Javascript, or Forth, a call can be either a function call or a method call.
Suppose a software library is written in a hybrid language. The software library includes a plurality of library subroutines, which are written in a style such that they have to be called as methods. This would be the case, for example, if the software library provides some classes and a user is supposed to create objects from the classes and call methods on those objects. If a user has created code that calls the library subroutines with function calls, the code will be successfully compiled but will produce undesirable behaviors at runtime.
Conventionally, the user will have to modify the existing code to ensure that the library subroutines are called as methods in the situation described above. However, in some programming languages (e.g., Perl), the use of method calls generally incurs additional time associated with performing a method lookup. Thus, forbidding function calls will deprive the user of the convenience and speed associated with function calls. Therefore, there is a need to improve software usability and flexibility, such that the above-mentioned problem can be overcome.